package com.cheer;

import com.cheer.migrate.HistoryMigrate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;

@SpringBootApplication
public class MigrateApplication implements ApplicationListener<ApplicationReadyEvent> {

    @Autowired
    private HistoryMigrate historyMigrate;

    public static void main(String[] args) {
        SpringApplication.run(MigrateApplication.class, args);
    }

    @Override
    public void onApplicationEvent(ApplicationReadyEvent event) {
        historyMigrate.migrate();
    }
}
